<template>
  <div id="home">
    <el-container>
      <el-aside width="null">
        <!-- 左侧导航栏 -->
        <Nav></Nav>
      </el-aside>
      <el-container>
        <!-- 表头 -->
        <el-header>
          <!--  面包屑 -->
          <Breadcrumb></Breadcrumb>

          <!-- 右侧用户信息 -->
          <div class="right">
            <div class="pic">
              <img src="../../images/snipaste20221124_150637.jpg" alt="" />
            </div>
            <div class="name">{{ username }}</div>
            <div class="two"><i class="el-icon-edit" @click="xiu()"></i></div>
            <div class="three" @click="centerDialogVisible = true">
              <i class="el-icon-delete"></i>
            </div>
            <!-- 退出提示 -->
            <el-dialog
              title="提示"
              :visible.sync="centerDialogVisible"
              width="30%"
              center
            >
              <span>是否退出当前账号</span>
              <span slot="footer" class="dialog-footer">
                <el-button @click="centerDialogVisible = false"
                  >取 消</el-button
                >
                <el-button type="primary" @click="del()">确 定</el-button>
              </span>
            </el-dialog>
          </div>
        </el-header>
        <!-- 中间内容跳转路由 -->
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import Nav from "../components/Nav.vue";
import Breadcrumb from "../components/Breadcrumb.vue";
import Cookie from "js-cookie";
export default {
  data() {
    return {
      centerDialogVisible: false,
      username: "",
    };
  },
  components: {
    Nav,
    Breadcrumb,
  },
  created() {
    let username = Cookie.get("username");
    console.log(username);
    this.username = username;
  },
  mounted() {},
  methods: {
    del() {
      this.$router.push("/login");
      Cookie.remove("token");
      Cookie.remove("id");
      Cookie.remove("username")
    },
    xiu() {
      this.$router.push("/revise");
    },
  },
};
</script>

<style scoped lang="less">
#home {
  .el-header {
    background-color: #fff;
    color: #333;
    height: 40px;
    text-align: center;
    line-height: 40px;
    display: flex;
    justify-content: space-between;
    .el-breadcrumb {
      margin-top: 25px;
    }
    .right {
      display: flex;
      align-items: center;

      .pic {
        width: 30px;
        height: 30px;
        border: #333 1px solid;
        border-radius: 30px;
        background-color: antiquewhite;
        margin: 0 5px;
        overflow: hidden;
        img {
          width: 100%;
        }
      }
      .two,
      .three {
        margin: 0 5px;
      }
    }
  }

  .el-aside {
    background-color: #262626;
    color: #333;
    text-align: center;
    line-height: 200px;
    min-height: 100vh;
  }
  .el-aside::-webkit-scrollbar {
    display: none;
  }
  .el-main {
    background-color: #f3f3f3;
    color: #333;
    // max-height: 2000px;
    // height: 1000px;
    // text-align: center;
  }
  .el-main::-webkit-scrollbar{
         display:none
    }
}
</style>
